package com.app.web.goods.category;

import com.alibaba.fastjson.JSON;
import com.app.utils.base.http.ResultUtil;
import com.app.utils.spring.properties.Config;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Description
 * Created by 王伟
 * Date create on 11:23 2019/11/25.
 */
@RestController
@RequestMapping("/goods/category/")
public class CategoryController {
    /**
     * 类目
     * @param level
     * @return
     */
    @RequestMapping(value = "list")
    public String categoryList(int level){
        List<Map<String,Object>> data = CategoryManager.categoryList(level);
        return ResultUtil.success(data);
    }

    @RequestMapping("sort")
    public String sort(){
        return ResultUtil.success(JSON.parseArray(Config.pp.get("category_sort"), Map.class));
    }
}
